$(function () {
	var isRun = busy = false;
	
	init();
	
	function init () {
		/*bus.pop({//自定义弹窗
			title: '标题',
			content: '测试？',
			align: 'center',
			buttonText: ['确定', '取消'],
			handleClick: function (index, text, done) {
				done();
			}
		});*/
		/* bus.loading(true, '请稍后...');//显示转菊花效果 */
		/* bus.showTip('提示。', function () {}); */
		/* bus.send({
			type: "get",
			url: "/VH/HealEnergy/rank",
			async: true,
			data: {},
			success: function (res) {
				if(res.code === bus.success) {
					
				};
			}
		}); */
		if(!isRun){
			loadMore();
			isRun = true;
		};
	};
	
	function loadMore () {
		if(!busy){
			busy = true;
			var html = '';
			var data = [
				{"a": 0},
				{"a": 1},
				{"a": 2},
				{"a": 3},
				{"a": 4},
				{"a": 5},
				{"a": 6},
				{"a": 7},
				{"a": 8},
				{"a": 9},
			];
			for(var i = 0; i < data.length; i++) {
				html += '<p>' + i + '</p>';
			};
			$('.scroll').append(html);
			if(data.length == 10) {
				busy = false;
			};
		};
	};
	
	window.onscroll = function (e) {
		bus.loadData(bus.getClientHeight(), bus.getScrollHeight(), bus.getScrollTop(), function () {
			loadMore();
		});
	};
	
	$('.scroll').on('scroll', function (e) {
		bus.loadData(e.target.clientHeight, e.target.scrollHeight, e.target.scrollTop, function () {
			loadMore();
		});
	});
});